package com.ruoyi.wechat.api;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.wechat.domain.Communication;
import com.ruoyi.wechat.service.ICommunicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 营地交流Controller
 * 
 * @author ruoyi
 * @date 2024-12-25
 */
@RestController
@RequestMapping("/wechat/communication")
public class WxCommunicationController extends BaseController
{
    @Autowired
    private ICommunicationService communicationService;

    /**
     * 查询营地交流列表
     */
    @GetMapping("/list")
    public AjaxResult list(Communication communication)
    {
        List<Communication> list = communicationService.selectCommunicationList(communication);
        System.out.println("list::::::::"+list);
        return success(list);
    }

    /**
     * 获取营地交流详细信息
     */
    @GetMapping(value = "/{communicationId}")
    public AjaxResult getInfo(@PathVariable("communicationId") String communicationId)
    {
        return success(communicationService.selectCommunicationByCommunicationId(communicationId));
    }

    /**
     * 新增营地交流
     */
    @PostMapping("/add")
    public AjaxResult add(@RequestBody Communication communication)
    {
        return toAjax(communicationService.insertCommunication(communication));
    }

    /**
     * 修改营地交流
     */
    @PutMapping
    public AjaxResult edit(@RequestBody Communication communication)
    {
        return toAjax(communicationService.updateCommunication(communication));
    }

    /**
     * 删除营地交流
     */
	@DeleteMapping("/{communicationIds}")
    public AjaxResult remove(@PathVariable String[] communicationIds)
    {
        return toAjax(communicationService.deleteCommunicationByCommunicationIds(communicationIds));
    }
}
